<template>
	<view>
		<view class="live-answer-pop" v-if="show">
			<view class="live-box" @click="to_live">
				<view class="close" @click.stop="show = false"></view>
				<view class="message-box">
					<view class="message">
						恭喜您被惊喜福利砸中，参与砸金蛋活动，最高可得{{liveInfo.maxReward}}积分！
						<!--            恭喜您被惊喜福利砸中，参与直播答题，答对获得一次砸金蛋机会，最高可获得{{liveInfo.maxReward}}积分-->
					</view>
				</view>
			</view>
		</view>
		<view class="button" v-if="buttonShow" @click="to_live">
			<image mode="aspectFit" :src="image_host+'ab8JXVRCvx2VRBudDUJWew.gif'"></image>
			<view class="msgs">
				<image mode="aspectFit" :src="image_host+'icon_jindanicon.png'"></image>
			</view>
		</view>
	</view>

</template>

<script>
	export default {
		name: "live-answer-pop",
		data() {
			return {
				show: false,
				liveInfo: {},
				image_host: this.image_host + 'liveAnswer/',
				buttonShow: false
			};
		},
		methods: {
			to_live() {
				this.show = false;
				let url = "/liveAnswer/index/index?questionnaireId=" + this.liveInfo.questionnaireId + '&liveTitle=' + this
					.liveInfo.liveTheme + '&maxReward=' + this.liveInfo.maxReward;
				//关闭当前页面跳转
				uni.redirectTo({
					url: url
				})
			},
			async getLiveInfo() {
				// if(!uni.getStorageSync("LiveMessageTime") || new Date().getTime()>=uni.getStorageSync("LiveMessageTime")){
				const res = await this.$javaApiTag.doRequest("get",
					'/tag/customerAnswerQuestionnaire/checkCustomerState', {}, '')
				console.log(res, '答题状态，，')
				if (res?.data?.data?.questionnaireId) {
					this.liveInfo = res.data.data
					if (res.data.data.isFrist === true) {
						this.show = true
					} else if (res.data.data.isFrist === false) {
						this.buttonShow = true
					}
					// }
				}
			}
		}
	}
</script>

<style scoped>
	.live-answer-pop {
		width: 100%;
		height: 100%;
		top: 0;
		left: 0;
		position: fixed;
		background-color: rgba(0, 0, 0, .5);
		z-index: 100;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.live-box {
		width: 701upx;
		height: 838upx;
		background-image: url(https://wechat-pictures-1301970825.file.myqcloud.com/wxapp/liveAnswer/img_zajindan_tankuang.png);
		background-size: 100% 100%;
		position: relative;
	}

	.message-box {
		width: 520upx;
		height: 269upx;
		border-radius: 10upx;
		background-color: #FFF6E5;
		position: absolute;
		top: 310upx;
		left: 50%;
		transform: translate(-50%, 0%);
		box-sizing: border-box;
		padding: 20upx;
	}

	.message {
		width: 100%;
		height: 100%;
		text-align: center;
		box-sizing: border-box;
		padding: 27upx 20upx;
		font-size: 38upx;
		color: #333;
		border: 2upx solid #F09966;
		border-radius: 10upx;
		overflow-y: scroll;
	}

	.close {
		width: 67upx;
		height: 67upx;
		background-image: url("https://wechat-pictures-1301970825.file.myqcloud.com/wxapp/dacu/home_icon_cloes@2x.png");
		background-size: 100% 100%;
		position: absolute;
		top: 20upx;
		right: 10upx;
	}

	.button {
		position: fixed;
		width: 180upx;
		height: 180upx;
		bottom: 440upx;
		left: 10upx;
		z-index: 10;
	}

	.button image {
		width: 100%;
		height: 100%;
	}

	.button .msgs {
		position: absolute;
		width: 146upx;
		height: 57upx;
		bottom: 0;
		left: 50%;
		transform: translate(-50%, 0);
	}

	.button .msgs image {
		width: 100%;
		height: 100%;
	}
</style>